<template>
    <el-card class="info-portraits">
        <div class="title-con">
            <img src="~@images/notice/编组3.png" alt="">
            <span class="title">&nbsp;企业画像</span>
        </div>
        
        <el-skeleton 
        :rows="1"
        :loading="!data.tender" 
        animated
        >

            <div class="body">
                <div class="info-row">
                    <div class="label">
                        招标人:
                    </div>

                    <div class="value">
                        <template v-if="data.tender">
                            <el-link 
                            type="primary"
                            @click="goPortraits(data.tender)" 
                            >
                                <span 
                                v-czc="['查公告-详情', '点击按钮' , '企业画像-招标人',0 ,'notice-btn-enterpriseBid']"
                                >
                                    {{data.tender}}
                                </span>

                                <img src="/images/icon/icon-hot.png"/>
                            </el-link>
                        </template>

                        <template v-else>
                            见正文
                        </template>
                    </div>
                </div>

                <div 
                v-if="type === 'zhong-biao'"
                class="info-row"
                >
                    <div class="label">
                        中标单位:
                    </div>

                    <div class="value">
                        <template v-if="data.bidder">
                            <el-link 
                            type="primary" 
                            :underline="false"
                            @click="goPortraits(data.bidder)" 
                            >
                                <span 
                                v-czc="['查公告-详情', '点击按钮' , '企业画像-中标单位',0 ,'notice-btn-enterpriseWinner']"
                                >
                                    {{data.bidder}}
                                </span>

                                <img src="/images/icon/icon-hot.png"/>
                            </el-link>
                        </template>

                        <template v-else>
                            见正文
                        </template>
                    </div>
                </div>

                <div 
                v-if="type === 'zhong-biao-hxr'"
                class="info-row"
                >
                    <div class="label">
                        中标候选人:
                    </div>
                    
                    <div class="value">
                        <template v-if="hxr.length">
                            <el-link 
                            type="primary" 
                            :underline="false"
                            v-for="(item,index) in hxr"
                            :key="index"
                            @click="goPortraits(item.COMPANY)" 
                            >
                                <span 
                                v-czc="['查公告-详情', '点击列表' , '企业画像-投标候选人', index, 'notice-list-enterpriseBidCandidate']"
                                >
                                    {{item.COMPANY}}
                                </span>

                                <img src="/images/icon/icon-hot.png"/>
                            </el-link>
                        </template>

                        <template v-else>
                            见正文
                        </template>
                    </div>
                </div>
            </div>
        </el-skeleton>
    </el-card>
</template>

<script>
export default {
    props: {
        data: {
            type: Object,
            default: () => {},
        },
        type: {
            type: String,
            default: 'zhao-biao',
        },
        hxr: {
            type: Array,
            default: () => [],
        },
    },
    data() {
        return {};
    },
    methods: {
        // 跳转企业画像
        goPortraits(company) {
            let data = {
                company: company,
            };
            
            this.$get(`${this.$store.state.api.tbUrl}/noticerelated/getqyinfo.json`, data, (data, res) => {
                this.$router.push({
                    path: '/portraits',
                    query: {
                        guid: res.tdata.guid,
                        company: res.tdata.searchname, // company
                    },
                });
            });
        },
    },
    mounted() {},
};
</script>

<style lang="scss" scoped>
@import '@css/var.scss';

$RightTitleColor: #343434;
$RightTitleFont: 14px;

.info-portraits{
    ::v-deep{
        .el-card__body{
            padding: 5px 10px 10px;
        }
    }

    .info-row{
        display: flex;

        & + .info-row{
            margin-top: 6px;
        }

        .label {
            margin-right: .5em;
        }

        .value{
            flex: 1;
        }
    }
}

.title-con {
    display: flex;
    align-items: center;
    padding: 10px 0;

    .title {
        color: $RightTitleColor; // $primaryColor;
        font-size: $RightTitleFont;
        font-weight: 600;
    }
}
</style>
